package com.rainbowelephant.fun.fitness;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Spinner;
import android.widget.TextView;
import android.support.v4.app.NavUtils;

public class RepCounterActivity extends Activity {
	
private int reps;	

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_rep_counter);

        reps = 0;
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_rep_counter, menu);
        return true;
    }

    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                NavUtils.navigateUpFromSameTask(this);
                return true;
        }
        return super.onOptionsItemSelected(item);
    }

	public void repReset(View view) {
		reps = 0;
		((TextView)findViewById(R.id.repNumber)).setText("" + reps);
	}
    
    public void repAdd (View view){
    	reps ++;
    	((TextView)findViewById(R.id.repNumber)).setText("" + reps);
    }
    public void repRemove (View view){
    	reps --;
		((TextView)findViewById(R.id.repNumber)).setText("" + reps);

    }
    public void finishActivity (View view){
    	
		Spinner workout = (Spinner)findViewById(R.id.workoutChoice);
		String workoutChoice = workout.getSelectedItem().toString();
		Intent intent = new Intent(this, WorkoutEndActivity.class);
		intent.putExtra("workoutChosen", workoutChoice);
    	startActivity(intent);
    }
    
    
}
